<%@ page language="java" import="java.util.*,com.stone.business.workcard.pojo.WorkCardOne_BZ,com.stone.business.workcard.pojo.MainWorkCardOne" pageEncoding="UTF-8"%>
<%@ page import="com.stone.business.workcard.pojo.Ryzzfg,com.stone.business.workcard.pojo.Wxdfx"%>
<%@ include file="/jsp/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
MainWorkCardOne mainWorkCardOne=(MainWorkCardOne)request.getAttribute("entity");
boolean dybz=false;
if(mainWorkCardOne==null||mainWorkCardOne.getId_sno()==null||mainWorkCardOne.getId_sno().equals("")||mainWorkCardOne.getId_sno()==0){
dybz=true;
}
%>

<html>
	<head>	
		<title>班组作业控制卡（二种票）</title>
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script>
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript" src="<%=contextPath%>/js/jquery.autogrow.js"></script> 
		<script type="text/javascript">
			$(document).ready (function() {
		
			$('textarea').autogrow();		
			});		
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				       {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            hidden:<%=session.getAttribute("btn_savekzk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
				            handler:function(){
				            	comt();
				            }
				        },'-',
						{
				            text: '审核通过',
				            icon:"<%=contextPath%>/" + "images/editlink.gif",
				            hidden:<%=session.getAttribute("btn_shenhe_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,			       
				            handler:function(){
				            	func_sh();
				            }
				        },'-',
						{
				            text: '打印',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            	print();
				            },
							disabled:<%=dybz%>
							
				        },'-',
				        {
				            text: '返回',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            	back();
				            }
				        }
			    	]
			    });
			});
			function func_sh(){			
		    	if(confirm("确定要审核通过选中的记录吗？")) {
		        	document.frmM.action = "<%=contextPath%>/workcardTwo!verifyWorkcardTwo.do?id=${entity.id_sno}";
					document.frmM.submit();
		    	}
			}
			function print(){			 
			 var url="<%=contextPath%>/workcardTwo!updateWorkcardTwo.do?directFlag=PRINT_SUCCESS&id=${entity.id_sno}";
			 var win = openSUB(url,2,800,600,50,30);
			 }			
			function getprojectinfo(){
			window.open("<%=contextPath%>/projectImplement!findByUnitno.do", '统计表格', 'height=800, width=350, top=200, left=300, toolbar=no, menubar=no');
			// document.frmM.action = "<%=contextPath%>/projectImplement!findByUnitno";
			}
			function func_load(){
				var imageId='${entity.pic_id}';
				var isTZ="${info}";
				//if(imageId!="0"&&isTZ!="审核成功!"){
				//var picture=document.getElementById("myImage");
				//picture.src="workcardTwo!fileDownload.do?id=${entity.pic_id}";				
				//picture.style.width="400px";
				//picture.style.height="300px";
				//picture.style.text-align="center";
				//}
				
				if(isTZ=="审核成功!"){
				//window.parent.location.href="<%=contextPath%>/jsp/business/workcard/gzzbTab.jsp?src=workcardTwoList!getList.do";
				}
			}
		</script>
	</head>
  
  <body topmargin="0" onload="func_load();">
  <div id = "tbar" style="position:absolute;display:block left:0px; top:0px; width:100%; height:35px; z-index:1;"></div>
	<br>
	<div id="Layer" style="position:absolute;display:block left:0px; top:35px; width:100%; height:94%; z-index:1000; overflow:auto;">
  <center>

			<!-- 信息提示 -->
			<div id="result"><font color="red">${info }</font></div>
		</center>
 		<form id="frmM" class="ct" name="frmM" method="POST" enctype="multipart/form-data" action="<%=contextPath%>/workcardTwo!addWorkcardTwo.do">
			<s:hidden name="entity.planid"/>
			<input type="hidden" name="entity.id_sno" id="entity.id_sno" value="${entity.id_sno}"/>
			<input type="hidden" name="entity.cjrid" id="entity.cjrid" value="${entity.cjrid}"/>
			<input type="hidden" name="entity.bxr" id="entity.bxr" value="${entity.bxr}"/>
			<s:hidden name="entity.sh_status"/>
			<s:hidden name="entity.oc_type"/>
			<s:hidden name="bdzid"/>
			<input type="hidden" name="id"  value="${entity.id_sno}"/>
			<table width="100%" border="0" id="infotab">
			<tr>
			<th width="120" nowrap>
						票号：
			</th>
			<td>
				
				<input type="text" style="width:50%"  name="entity.pno" maxlength="20" size="20" datatype="LimitB" min="0" max="20" msg="票号不能超过20个字符" value="${entity.pno}" />				
				
			</td>			
			<th width="120" nowrap>
						编写人：
			</th>
			<td>
				
				<input type="text" style="width:50%" readonly="true" name="entity.bxr" value="${entity.bxr}" disabled \/>				
				
			</td>
			</tr>
			<s:if test="entity.sh_status!=\"2\"&&entity.sh_status!=\"\"">
			
			<tr>
			<th width="120" nowrap>
						审核人：
			</th>
			<td>		
				<input type="text" style="width:50%" readonly="true" name="entity.sp" value="${entity.sp}" />		
			</td>			
			<th width="120" nowrap>
						审核状态：
			</th>
			<td>
				
				<input type="text" style="width:50%" readonly="true" name="entity.sh_status_name" value="${entity.sh_status_name}" \/>				
				</td>
			</tr>	
			</s:if>
			</table>
	 		<table width="100%" id="listtab1" class = "leadertab" >		
				<tr>				
					<th colspan="3">现场安全措施示意图 </th>
				</tr>
				<tr align="center">
					<td align="center">
						<div id="myImagequ">
							<s:if test="picUrl!=null&&picUrl!=''">			
							  <img id="myImage" src="${picUrl}" />
							  <input type="hidden" name="entity.pic_id" value="${entity.pic_id }"/>
							</s:if>
						</div>
					</td>
				</tr>
				<tr>
					<td>
						<s:if test="entity.id_sno!=null && entity.id_sno!=0&&bdzid!=''">	
							<input type="button" value="绘制示意图" onclick="prepareDraw();">
						</s:if>
					</td>
				</tr>
			</table>
			<table width="100%" id="listtab2" class = "leadertab" >		
				<tr>				
					<th width="30">
					<% if ((session.getAttribute("btn_addkzk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
						<img src="<%=contextPath%>/images/add.gif" onclick = "addRyzzfg()" style="cursor:pointer"/>
					<%} %>
					</th>
				<th colspan="3"> 人员组织分工 </th>
				
				</tr>
				<tr>
					<th></th>
					<th width="30">序号</th>
					<th width="70%">作业内容</th>					
					<th width="25%">作业人员</th>
					
				</tr>	
				<c:forEach items="${ryzzfgList}" var="ryzzfg" varStatus="tatus" >
				<tr id = "tr${tatus.index}" class = "repeat">
				<td width="30">
				<% if ((session.getAttribute("btn_deletekzk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>	
				<img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,${ryzzfg.id_sno},1)" style="cursor:pointer"/>
				<%} %>
				</td>
				<td  width="30">${tatus.index+1}</input>
				<td  width="70%"> <textarea  id="zynr[${tatus.index}]"  name="ryzzfgList[${tatus.index}].oc_zynr"  datatype="LimitB" min="0" max="2000" msg="作业内容不能超过2000个字符"  style="width:100%; height: 25px; min-height: 20px;line-height:15pt" >${ryzzfg.oc_zynr}</textarea></td >
				<td width="25%" nowrap><input type="text" id="zyry[${tatus.index}]" datatype="LimitB" min="0" max="200" msg="作业人员不能超过200个字符" name="ryzzfgList[${tatus.index}].oc_zyry" style="width:100%;" value="${ryzzfg.oc_zyry}" ></input></td>		
				
				</tr>
				</c:forEach>	
				
			</table>
	
			<table width="100%" id="listtab3" class = "leadertab" >		
				<tr>				
					<th width="30">
					<% if ((session.getAttribute("btn_addkzk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
							<img src="<%=contextPath%>/images/add.gif" onclick = "addWxdfx()" style="cursor:pointer"/>
					<%} %>
					</th>
				<th colspan="6">危险点分析 </th>
				
				</tr>
				<tr>
					<th></th>
					<th width="30">序号</th>
					<th width="40%">危险点（因素）</th>					
					<th width="30%">防范控制措施</th>
					<th width="15%">工作状态</th>
					<th width="60">完成时间</th>
					<th width="45">负责人</th>
				</tr>		
				<c:forEach items="${wxdfxList}" var="wxdfx" varStatus="tatus" >
				<tr id = "tr${tatus.index}" class = "repeat">
				<td width="30">
				<% if ((session.getAttribute("btn_deletekzk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
				<img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,${wxdfx.id_sno},2)" style="cursor:pointer"/>
				<%} %>
				</td>
				<td  width="30">${tatus.index+1}</input>
				<td  width="40%"> <textarea id="wxd[${tatus.index}]" name="wxdfxList[${tatus.index}].oc_wxd"  datatype="LimitB" min="0" max="1000" msg="危险点不能超过1000个字符" style="width:100%; height: 25px; min-height: 20px;line-height:15pt" >${wxdfx.oc_wxd}</textarea></td >
				<td width="30%" nowrap><textarea type="text" id="ffkzcs[${tatus.index}]" name="wxdfxList[${tatus.index}].oc_ffkzcs" datatype="LimitB" min="0" max="2000" msg="防范控制措施不能超过2000个字符"  style="width:100%; height: 25px; min-height: 20px;line-height:15pt" >${wxdfx.oc_ffkzcs}</textarea></td>
				<td width="15%" nowrap="nowrap">
				<input type="radio" id="oc_gzzt[${tatus.index}]" name="wxdfxList[${tatus.index}].oc_gzzt" value="01" ${wxdfx.oc_gzzt=="01"?"checked":""} onClick="getSysdateAndFzr(this,'${tatus.index}');"/>已完成
				<input type="radio" id="oc_gzzt[${tatus.index}]" name="wxdfxList[${tatus.index}].oc_gzzt" value="02" ${wxdfx.oc_gzzt=="02"?"checked":""} onClick="getSysdateAndFzr(this,'${tatus.index}');"/>正在执行
				<input type="radio" id="oc_gzzt[${tatus.index}]" name="wxdfxList[${tatus.index}].oc_gzzt" value="00" ${wxdfx.oc_gzzt=="00"?"checked":""} onClick="getSysdateAndFzr(this,'${tatus.index}');"/>未执行
				</td >	
				<td width="10">	
				<input size="12" type="text" id="oc_wcsj[${tatus.index}]" readonly value="${wxdfx.oc_wcsj}" name="wxdfxList[${tatus.index}].oc_wcsj"  />
				</td>									
				<td width="10">	
				<input size="3" type="text" id="oc_fzr[${tatus.index}]" readonly value="${wxdfx.oc_fzr}" name="wxdfxList[${tatus.index}].oc_fzr"  />
				</td>
				</tr>
				</c:forEach>
				
			</table>				
			
			
 			<table width="100%" id="listtab1" class = "leadertab" >		
				<tr>				
					
				<th colspan="3">安全工器具检查 </th>
				
				</tr>
			</table>	
		    <s:checkboxlist name="entity.checked_tools" list="listcheckbox" 
		     listKey="keyid" 
		     listValue="keyname"
		     key="安全工器具检查"		     
		     >
		    </s:checkboxlist>
				
			<table width="100%" id="listtab" class = "leadertab" >		
				<tr>				
					<th width="30">
						<% if ((session.getAttribute("btn_addkzk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
							<img src="<%=contextPath%>/images/add.gif" onclick = "setHTML()" style="cursor:pointer"/>
							<%} %>
					</th>
				<th colspan="3"> 管理人员到位 </th>
				
				</tr>
				<tr>
					<th></th>
					<th width="20%">到位时间</th>
					<th width="20%">到位人员</th>					
					<th width="60%">发现问题及建议</th>
					
				</tr>
				
				<c:forEach items="${workCardOneBZList}" var="cardbz" varStatus="tatus" >
				<tr id = "tr${tatus.index}" class = "repeat">
				<td width="30">
				<% if ((session.getAttribute("btn_deletekzk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
				<img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,${cardbz.id_sno},3)" style="cursor:pointer"/>
				<%} %>
				</td>
				<td  width="20%">
				<input type="text"   readonly="true"  datatype="Require"  size="12" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',el:$dp.$('dwdate[${tatus.index}]')})" size="25" msg="开始日期必须输入。" id="dwdate[${tatus.index}]" name="workCardOneBZList[${tatus.index}].dwdate" value='<fmt:formatDate value="${cardbz.dwdate}" pattern="yyyy-MM-dd HH:mm"/>'></input>
				<img onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',el:$dp.$('dwdate[${tatus.index}]')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle"></td >
				<td nowrap><input type="text" id="dwry[${tatus.index}]" value="${cardbz.dwry}" datatype="LimitB" min="0" max="200" msg="到位人员不能超过200个字符" name="workCardOneBZList[${tatus.index}].dwry"  ></input></td>
				<td nowrap><textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="发现问题及建议不能超过2000个字符" id=quetionandsuggest[${tatus.index}] name="workCardOneBZList[${tatus.index}].quetionandsuggest" >
				${cardbz.quetionandsuggest}
				</textarea></td >			
				
				</tr>
				</c:forEach>

			</table>
				<%
				List<WorkCardOne_BZ> workcardone_bz=(List<WorkCardOne_BZ>)request.getAttribute("workCardOneBZList");
				
				if(workcardone_bz!=null&&workcardone_bz.size()!=0){
				%>
				<input type="hidden" id="manylist" value="<%=workcardone_bz.size()%>"/>
				<%}else{%>
				<input type="hidden" id="manylist" value="0"/>
				<%}%>
				<%
				List<Ryzzfg> ryzzfgList =(List<Ryzzfg>)request.getAttribute("ryzzfgList");
				
				if(ryzzfgList!=null&&ryzzfgList.size()!=0){
				%>
				<input type="hidden" id="size_ryzzfgList" value="<%=ryzzfgList.size()%>"/>
				<%}else{%>
				<input type="hidden" id="size_ryzzfgList" value="0"/>
				<%}%>	
				<%
				List<Wxdfx> wxdfxList =(List<Wxdfx>)request.getAttribute("wxdfxList");
				
				if(wxdfxList!=null&&wxdfxList.size()!=0){
				%>
				<input type="hidden" id="size_wxdfxList" value="<%=wxdfxList.size()%>"/>
				<%}else{%>
				<input type="hidden" id="size_wxdfxList" value="0"/>
				<%}%>	
   </form>
   </div>
  </body>
</html>
<script language="javascript">
	function lookImage (imgFile){
		
	    var path = imgFile.value;
	    if(path==""){
			return false;
		    }
	    if( !imgFile.value.match( /.jpg|.gif|.png|.bmp/i ) ){        
	       alert('图片格式错误');        
	       return false;        
	   }
	    if( imgFile.files &&  imgFile.files[0] ){        
	        // Firefox 因安全性问题已无法直接通过 input[file].value 获取完整的文件路径        
	        path = imgFile.files[0].getAsDataURL();            
	    } 
	    //解决IE7，IE8由于安全问题不能获取全路径的问题 
	    var isIE = (document.all) ? true : false;
	    var isIE7 = isIE && (navigator.userAgent.indexOf('MSIE 7.0') != -1);
	    var isIE8 = isIE && (navigator.userAgent.indexOf('MSIE 8.0') != -1);
	    if(isIE7 || isIE8){
	        imgFile.select();
	        path=document.selection.createRange().text;
	        document.selection.empty();
	    }
	    $('#myImagequ').empty();
	    $('#myImagequ').append("<img id='myImg' src='"+path+"' style='width:400px;height:300px;text-align:center'/>");	   
	    
	    // IE7,IE8 在设置本地图片地址为 img.src 时出现莫名其妙的后果        
	    //（相同环境有时能显示，有时不显示），因此只能用滤镜来解决    
	   
	 }  
	var usernum=parseInt(document.getElementById("manylist").value);
	function getSysdateAndFzr(obj,num){
	var number=parseInt(num);
	if(obj.value!="01"){
		var_wcsj=eval('document.getElementById("oc_wcsj['+number+']")');
		var_wcsj.value='';
		var_fzr=eval('document.getElementById("oc_fzr['+number+']")');	
		var_fzr.value='';						
	return false;
	}
	Ext.Ajax.request({
						method :'POST',
						url :'gxzlkzk!getSysdateAndFzr.do',						
						success : function(response) {
							//Ext.MessageBox.alert('提示', response.responseText);	
							var data=Ext.decode(response.responseText);
							var_wcsj=eval('document.getElementById("oc_wcsj['+number+']")');
							var_wcsj.value=data.sysdate;
							var_fzr=eval('document.getElementById("oc_fzr['+number+']")');	
							var_fzr.value=data.fzr;							
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '异步失败！');
						}
					});
	}
	// 增加行
	 function setHTML() {		
		 var temp = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',el:$dp.$('dwdate[" + usernum + "]')})";
		 
			var str = 	'<tr id = '+ usernum +' class = "repeat">' +
			'<td width="30"><img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,0,1)" style="cursor:pointer"/></td>' + 
			'<td  width="20%"><input type="text"   readonly="true"  datatype="Require" size="12" onclick="'+temp+'" size="25" msg="到位日期必须输入。" id="dwdate['+ usernum + ']" name="workCardOneBZList['+usernum+'].dwdate" ></input>'+
			'<img onclick="'+temp+'" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle"></td >' +
			'<td nowrap><input type="text" id="dwry['+usernum+']" name="workCardOneBZList['+usernum+'].dwry" datatype="LimitB" min="0" max="200" msg="到位人员不能超过200个字符" ></input></td>' +
			'<td nowrap><textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="发现问题及建议不能超过2000个字符"  id=quetionandsuggest['+ usernum + '] name="workCardOneBZList['+usernum+'].quetionandsuggest" ></textarea></td >' +					
			'</tr>';
						
			$('#listtab').append(str);	
					
			usernum++;	
			$('textarea').autogrow();
	}
	var ryzzfgnum=parseInt(document.getElementById("size_ryzzfgList").value);
	 function addRyzzfg() {
			var str = 	'<tr id = '+ ryzzfgnum+' class = "repeat">' +
			'<td width="30"><img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,0,1)" style="cursor:pointer"/></td>' + 
			'<td  width="30">'+(ryzzfgnum+1)+'</td >' +
			'<td  width="70%"> <textarea type="text" id="zynr['+ryzzfgnum+']" name="ryzzfgList['+ryzzfgnum+'].oc_zynr" datatype="LimitB" min="0" max="2000" msg="作业内容不能超过2000个字符"  style="width:100%; height: 25px; min-height: 20px;line-height:15pt" ></textarea></td >' +
			'<td nowrap><input type="text" id="zyry['+ryzzfgnum+']" datatype="LimitB" min="0" max="200" msg="作业人员不能超过200个字符" name="ryzzfgList['+ryzzfgnum+'].oc_zyry"  ></input></td>'+							
			'</tr>';
						
			$('#listtab2').append(str);	
					
			ryzzfgnum++;	
			$('textarea').autogrow();
	}
	var wxdfxnum=parseInt(document.getElementById("size_wxdfxList").value);
	 function addWxdfx() {
		 
			var str = 	'<tr id = '+ wxdfxnum+' class = "repeat">' +
			'<td width="30"><img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,0,1)" style="cursor:pointer"/></td>' + 
			'<td  width="30">'+(wxdfxnum+1)+'</td >' +
			'<td  width="40%"> <textarea type="text" id="wxd['+wxdfxnum+']" name="wxdfxList['+wxdfxnum+'].oc_wxd" datatype="LimitB" min="0" max="1000" msg="危险点不能超过1000个字符" style="width:100%; height: 25px; min-height: 20px;line-height:15pt" ></textarea></td >' +
			'<td width="30%" nowrap><textarea type="text" id="ffkzcs['+wxdfxnum+']" name="wxdfxList['+wxdfxnum+'].oc_ffkzcs" datatype="LimitB" min="0" max="2000" msg="防范控制措施不能超过2000个字符" style="width:100%; height: 25px; min-height: 20px;line-height:15pt" ></textarea></td>'+							
			'<td width="15%">'+
			'<input type="radio" id="oc_gzzt['+wxdfxnum+']" name="wxdfxList['+wxdfxnum+'].oc_gzzt" value="01" onClick="getSysdateAndFzr(this,'+wxdfxnum+');"/>已完成'+
			'<input type="radio" id="oc_gzzt['+wxdfxnum+']" name="wxdfxList['+wxdfxnum+'].oc_gzzt" value="02" onClick="getSysdateAndFzr(this,'+wxdfxnum+');"/>正在执行'+
			'<input type="radio" id="oc_gzzt['+wxdfxnum+']" name="wxdfxList['+wxdfxnum+'].oc_gzzt" value="00" onClick="getSysdateAndFzr(this,'+wxdfxnum+');"/>未执行'+
			'</td >	'+
			'<td>	'+
			'<input size="12" type="text" id="oc_wcsj['+wxdfxnum+']"  value="${wxdfx.oc_wcsj}" readonly name="wxdfxList['+wxdfxnum+'].oc_wcsj"  />'+			
			'</td>		' +		
			'<td>	'+
			'<input size="3" type="text" id="oc_fzr['+wxdfxnum+']"  value="${wxdfx.oc_fzr}" readonly name="wxdfxList['+wxdfxnum+'].oc_fzr"  />'+			
			'</td>		' +		
			'</tr>';
						
			$('#listtab3').append(str);	
					
			wxdfxnum++;	
			$('textarea').autogrow();
	}	
	
	//删除班组作业控制卡（一种票）
	function toSeeRwd(id){
		
			if(!isChecked("id")) {
		 		alert("请选择一条记录");
		 		return false;
		 	}
 
		 	id1 = getCheckValue("id");//获取id值
			
		alert(id1);
   
				}

		
		//删除一行（已有数据）
		function delrow(row,id,deltype){
	 //window.alert(deltype);
	 
			if (confirm("确定要删除该条记录吗？")) {
				if(id != 0) {
					Ext.Ajax.request({
						method :'POST',
						url :'workcardTwo!deleteDetail.do?id=' + id,
						params : {deltype:deltype},
						success : function(response, options) {
							var obj = Ext.decode(response.responseText);
							Ext.MessageBox.alert('提示', obj["msg"]);
						
		   					$(row).parents(".repeat").remove();	
	 
						},
						failure : function(response, options) {
							Ext.MessageBox.alert('提示 ', '删除失败。');
						}
					});
				} else {
					$(row).parents(".repeat").remove();	
				}
	 
			}
	 
		} 		
	 // 保存
     function comt(){
        if(!Validator.Validate(frmM,1)){
			return false;
		}
     	document.frmM.action = "<%=contextPath%>/workcardTwo!addWorkcardTwo.do";
		//document.frmM.action = "<%=contextPath%>/jsp/sys/gzzbTab.jsp?src=workcardOne!addWorkcardOne.do";
     	document.frmM.submit();
     }
     
     // 返回
     function back() {
       // window.parent.window.location.href = "<%=contextPath%>/jsp/business/workcard/gzzbTab.jsp?src=workcardTwoList!getList.do";
		//window.parent.window.location.href = "<%=contextPath%>/workcardOneList!getList.do?da="+date();
		document.frmM.action = "<%=contextPath%>/workcardTwoList!getList.do";
		document.frmM.submit();
		
     }
 // 附件列表
	 function filePopup(id,colname,imageflag) {
		 var url = "<%=contextPath%>/jsp/common/fileTab.jsp?tableid=" + id + "&colname="+colname+"&imageflag="+imageflag;// "<%=contextPath%>/sb!test.do?id="+id;
		 var win = window.open(url,"图片列表","left=450,top=30,width=850,height=500,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	}
		// 批准, 审核
		function toConfirm(flag)
		{
		
				var msg = flag == '1' ? '提交':'审核通过';
				
		    	if(confirm("确定要" + msg + "选中的记录吗？")) {
		        	document.frmM.action = "<%=contextPath%>/plan!saveMonthPlan.do?flag=" + flag;
					document.frmM.submit();
		    	}
		}
		// 起草计划班组工作任务
		function toNewRwd(paramBzid,paramPlanid){
		//window.alert(paramBzid);window.alert(paramPlanid);
		// 打开窗口
		//parent.addTab("班组工作任务", "<%=contextPath%>/jsp/business/plan/bzgzrw.jsp?paramBzid="+paramBzid+"&paramPlanid="+paramPlanid, paramBzid);
    var url = "<%=contextPath%>/jsp/business/plan/bzgzrw.jsp?paramBzid="+paramBzid+"&paramPlanid="+paramPlanid;
		 var win = window.open(url,"计划任务列表","left=450,top=30,width=850,height=500,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	
				}
				
	function prepareDraw(){
		//alert(document.getElementById("bdzid").value);
		var url = "<%=contextPath%>/bdz!getBdzAttachment.do?pageFrom=workcard&id="+document.getElementById("bdzid").value + "&kzkid=${entity.id_sno}" ;
		var win = window.open(url,"变电站图片列表","left=450,top=30,width=850,height=500,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	}					
</script>
